<%@page contentType="text/xml" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html
   xmlns="http://www.w3.org/1999/xhtml"
   xmlns:xf="http://www.w3.org/2002/xforms"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:ftype="http://localhost:8080/WAXDBForms/simpleXForms/schema.xsd">
   <head>
      <title>Validate Postal Codes</title>
      <style type="text/css">
         @namespace xf url("http://www.w3.org/2002/xforms");
         xf|input {
            display: table-row;
            line-height: 2em;
         }

         xf|label {
            display: table-cell;
            text-align: right;
            font-family: Arial, Helvetica, sans-serif;;
            font-weight: bold;
            padding-right: 5px;
            width: 150px;
         }

         *:required {
             background-color: yellow;
         }

         *:invalid  {
            background-color: fuchsia;
         }

      </style>
      <xf:model schema="schema.xsd">
         <xf:instance>
            <data xmlns="http://localhost:8080/WAXDBForms/simpleXForms/schema.xsd">
                <zip type="ftype:zipType"></zip>
                <zip2 type="ftype:zip2Type"></zip2>
            </data>
         </xf:instance>
         <xf:bind id="zip" required="true()" type="ftype:zipType" nodeset="ftype:zip" />
         <xf:bind id="zip2" required="true()" type="ftype:zip2Type" nodeset="ftype:zip2" />
      </xf:model>
   </head>
   <body>
      <xf:input bind="zip" incremental="false">
         <xf:label>Zip Code: </xf:label>
         <xf:hint>Validation is not correctly specified for this field</xf:hint>
         <xf:alert>The 'Zip Code' failed to validate!</xf:alert>
      </xf:input>
      <xf:input bind="zip2" incremental="false">
         <xf:label>Zip Code 2: </xf:label>
         <xf:hint>Validation is correctly specified for this field</xf:hint>
         <xf:alert>
           <xf:output value="concat('The &amp;quot;', name(), '&amp;quot; failed to validate!')" />
         </xf:alert>
      </xf:input>
   </body>
</html>
